import request from '@/utils/request'

// 简单测试
export function test() {
  return request({
    url: 'manage/mechanism/hello',
    method: 'get',
  })
}

// 查询机构列表
export function listMechanism(query) {
  return request({
    url: '/manage/mechanism/list',
    method: 'get',
    params: query
  })
}

// 查询子机构列表
export function getUnderMechanism(query,id) {
  return request({
    url: '/manage/mechanism/getChildrenByParentId/' + id,
    method: 'get',
    params: query
  })
}

//  搜索
export function getListByParam(query) {
  return request({
    url: '/manage/mechanism/getListByMechanismCodeAndMechanismName?',
    method: 'get',
    params: query
  })
}


// 新增岗位
export function addMechanism(data) {
  return request({
    url: '/manage/mechanism/addMechanism',
    method: 'post',
    data: data
  })
}

// 删除岗位
export function delPost(postId) {
  return request({
    url: '/manage/mechanism/delMechanism/' + postId,
    method: 'delete'
  })
}



// 查询岗位详细
export function getPost(postId) {
  return request({
    url: '/system/post/' + postId,
    method: 'get'
  })
}

// 修改岗位
export function updatePost(data) {
  return request({
    url: '/system/post',
    method: 'put',
    data: data
  })
}
